﻿Imports BUS
Imports DTO
Public Class frmBaoCaoMoDongSoThang
    Private _tenNhanVien As String
    Public Property TenNhanVien() As String
        Get
            Return _tenNhanVien

        End Get
        Set(ByVal value As String)
            _tenNhanVien = value
        End Set
    End Property
    Private Sub frmBaoCaoMoDongSoThang_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim ltkBUS As New LoaiTietKiemBUS()
        Dim dsltk As New List(Of LoaiTietKiemDTO)()
        dsltk = LoaiTietKiemBUS.LayLoaiTietKiem()
        cmbLoaiTietKiem.DataSource = dsltk
        cmbLoaiTietKiem.DisplayMember = "TenLoaiTietKiem"
        cmbLoaiTietKiem.ValueMember = "MaLoaiTietKiem"
        cmbLoaiTietKiem.SelectedValue = 0
    End Sub

    Private Sub btnBaoCao_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBaoCao.Click
        If cmbLoaiTietKiem.SelectedValue = 0 Then
            MessageBox.Show("Chưa chọn lọai tiết kiệm")
            cmbLoaiTietKiem.Focus()
            Return
        End If
        Dim rpt As New CrystalReportBaoCaoMoDongSoThang()
        Dim ngay As Date = dtpThang.Value.Date
        Dim stkBUS As New SoTietKiemBUS()
        Dim dt As DataTable = stkBUS.SoMoDong(ngay, cmbLoaiTietKiem.SelectedValue)
        rpt.SetDataSource(dt)
        Dim thangnam As String = dtpThang.Value.Month.ToString() + "/" + dtpThang.Value.Year.ToString()
        rpt.SetParameterValue("thang", thangnam)
        rpt.SetParameterValue("NguoiLapBaoCao", _tenNhanVien)
        CrystalReportViewer1.ReportSource = rpt
    End Sub
End Class